<%--
  @author Supun Nimesh Karunathilaka
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
    $(document).ready(function () {
        $('.land-table').dataTable({
            "sPaginationType":"full_numbers",
            "bDestroy":true,
            "oLanguage":{
                "sZeroRecords":$('#no-record').val(),
                "sLengthMenu":$('#display').val() + " _MENU_ " + $('#records').val(),
                "sSearch":$('#search').val(),
                "sInfo":$('#showing').val() + " _START_ " + $('#to').val() + " _END_ " + $('#of').val() + " _TOTAL_ " + $('#entries').val(),
                "sInfoEmpty":$('#no-record').val(),
                "oPaginate":{
                    "sFirst":$('#first').val(),
                    "sLast":$('#last').val(),
                    "sNext":$('#next').val(),
                    "sPrevious":$('#previous').val()
                }
            },
            "fnDrawCallback":function () {
                if ($('.dataTables_paginate span span.paginate_button').size()) {
                    $('.dataTables_paginate')[0].style.display = "block";
                } else {
                    $('.dataTables_paginate')[0].style.display = "none";
                }
            }
        });
    });
</script>
<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="landRegistrationModule.do">
        <span><img src="${pageContext.request.contextPath}/images/land-reg.png" alt="Land Registration">
            <s:label value="%{getText('land_registration.label')}"/></span>
    </s:a>
    <span class="module-title-breaker"> > </span>
    <s:a href="viewScheduledLandVisits.do">
        <span><img src="${pageContext.request.contextPath}/images/view-schedule.png" alt="View Schedule Land Visits">
        <s:label value="%{getText('view_scheduled_land_visits.label')}"/></span>
    </s:a>
</div>
<div id="view-scheduled-land-visits-div">
    <h2><s:label value="%{getText('scheduled_land_visits.label')}"/></h2>
    <s:if test="hasActionErrors() || hasActionMessages()">
        <div id="message-box" class="message-box">
            <div class="action-msg"><s:actionmessage/></div>
            <div class="action-err"><s:actionerror/></div>
        </div>
    </s:if>
    <table>
        <tr>
            <td align="right">
                <s:a href="scheduleLandVisits.do">
                    Add New Schedule
                </s:a>
            </td>
        </tr>
    </table>
    <table class="width-100 margin-10-auto table land-table">
        <thead>
        <tr class="left-align table-header">
            <th class="center-align"><s:label value="#"/>&nbsp;</th>
            <th class="center-align" width="150px"><s:label value="%{getText('gn_division.label')}"/></th>
            <th class="center-align" width="100px"><s:label value="%{getText('schedule_date.label')}"/></th>
            <th class="center-align"><s:label value="%{getText('land_names.label')}"/></th>
            <th class="center-align" width="60px"><s:label value="%{getText('delete.label')}"/></th>
        </tr>
        </thead>
        <tbody>
        <s:iterator status="status1" value="scheduleList">
            <tr class="<s:if test="#status1.odd == true">table-row-odd</s:if><s:else>table-row-even</s:else>t">
                <td class="left-align"><s:label value="%{#status1.count}"/></td>
                <td class="left-align"><s:property value="gnDivision.enDivisionName"/></td>
                <td class="center-align"><s:property value="endDate"/></td>
                <td class="left-align">
                    <s:iterator status="status1" value="landList">
                        <s:property value="nameOfTheLand"/></br>
                    </s:iterator>
                </td>
                <td class="center-align">
                    <s:url id="deleteSchedule" action="deleteScheduledLandVisits">
                        <s:param name="scheduleId" value="id"/>
                    </s:url>
                    <s:a href="%{deleteSchedule}" title="%{getText('delete_schedule.label') } ">
                        <img src="<s:url  value='/images/reject.png'/>" border="none" width="25"
                             height="25"/>
                    </s:a>
                </td>
            </tr>
        </s:iterator>
        </tbody>
    </table>
</div>

<%-- Localization text for data tables --%>
<s:hidden id="display" value="%{getText('display.label')}"/>
<s:hidden id="records" value="%{getText('records.label')}"/>
<s:hidden id="search" value="%{getText('search.label')}"/>
<s:hidden id="no-record" value="%{getText('no_record.label')}"/>
<s:hidden id="showing" value="%{getText('showing.label')}"/>
<s:hidden id="to" value="%{getText('to.label')}"/>
<s:hidden id="of" value="%{getText('of.label')}"/>
<s:hidden id="entries" value="%{getText('entries.label')}"/>
<s:hidden id="first" value="%{getText('first.label')}"/>
<s:hidden id="last" value="%{getText('last.label')}"/>
<s:hidden id="next" value="%{getText('next.label')}"/>
<s:hidden id="previous" value="%{getText('previous.label')}"/>
<s:hidden id="viewTooltip" value="%{getText('schedule_remove_tooltip')}"/>




